/**
 * Copyright (c) 2015, （版权声明）
 *
 * @file	CustomServerApplication.cpp
 * @brief CustomServerApplication 类的实现。包括程序的初始化，反初始化部分。
 *
 *
 * @author: 		yuhaiyang
 * @date: 		2015年5月6日
 *
 * 修订说明:初始版本
 */

#include "CustomServerApplication.h"
#include "AppLog.h"

using namespace Poco;
using namespace Taiji::TUtil;

void CustomServerApplication::_init() {
    std::cout << "=============开始初始化==============" << std::endl;
    std::cout << "-------------初始化日志--------------" << std::endl;
    __initLog();
    std::cout << "-------------初始化mysql--------------" << std::endl;
    __initMysql();
    std::cout << "-------------初始化server--------------" << std::endl;
    __initServer();
}

void CustomServerApplication::_start() {
    std::cout << "=============开始正式启动应用==============" << std::endl;
    APPLOG::instance().information(ELogType::IN,__FILE__,__func__,"","","start server ok!!");
}

void CustomServerApplication::_stop() {
    std::cout << "=============退出启动应用==============" << std::endl;
    APPLOG::instance().information(ELogType::IN,__FILE__,__func__,"","","stop server ok!!");}

void CustomServerApplication::__initLog() {
    // init device logger
    std::string logDir = config().getString("LOG.dir");
    std::string logFile = config().getString("LOG.file");
    std::string logName = config().getString("LOG.name");
    std::string logLevel = config().getString("LOG.level", CLog::DEFAULT_LOG_LEVEL);
    std::string LogRotation = config().getString("LOG.rotation",
    CLog::DEFAULT_LOG_ROTATION);
    std::string LogPurgeAge = config().getString("LOG.purgeAge",
    CLog::DEFAULT_LOG_PURGEAGE);
    APPLOG ::instance().initLog(logDir, logFile, logName ,logLevel, LogRotation, LogPurgeAge);
}

void CustomServerApplication::__initMysql() {

}

void CustomServerApplication::__initServer() {

}



